package com.glsc.ngateway.oaflow.controller;

import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.glsc.ngateway.common.api.common.dto.PageDto;
import com.glsc.ngateway.common.api.common.dto.PageQueryParamDto;
import com.glsc.ngateway.common.api.common.enums.GatewayConstant;
import com.glsc.ngateway.common.api.oaflow.dto.FlowDetailFrontDto;
import com.glsc.ngateway.common.api.oaflow.dto.OaRequestLogResp;
import com.glsc.ngateway.common.api.oaflow.dto.SystemFlowStatisticsSearchParamDto;
import com.glsc.ngateway.common.api.oaflow.dto.VITSystemOAFlowResourceDto;
import com.glsc.ngateway.common.api.oaflow.dto.oa.OaParaDto;
import com.glsc.ngateway.common.api.oaflow.dto.oaflow.*;
import com.glsc.ngateway.common.api.oaflow.dto.oaform.FormInfoDto;
import com.glsc.ngateway.common.api.oaflow.dto.param.ParamFlowSearchDto;
import com.glsc.ngateway.common.api.oaflow.resp.CommonResponse;
import com.glsc.ngateway.common.api.oaflow.resp.InterfaceResponse;
import com.glsc.ngateway.common.api.oaflow.resp.OaflowResponse;
import com.glsc.ngateway.common.base.converter.oaflow.WorkflowRequestbaseConverter;
import com.glsc.ngateway.common.base.domain.oracle.ecology.WorkflowRequestbase;
import com.glsc.ngateway.oaflow.service.*;
import com.glsc.ngateway.oaflow.utils.DateUtils;
import com.google.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 这个Controller提供的服务供资管自研系统使用
 * <p>
 * 从原glsc_oagateway的FlowWorkController迁移过来
 * <p>
 * 对反馈对象做了修改，所以所有调用方如果要迁移有开发量
 */
@RestController
@RequestMapping("/xy")
public class XYController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    XyService xyService;

    /**
     * 原始版，不做转换
     *
     * @param param
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "callXy")
    public String callXy(@RequestBody String param) throws Exception {
        logger.info("开始创建流程原始版，param参数:" + param + ",时间:" + DateUtils.getCurrentDate(DateUtils.formatSecond));
        String reuslt = xyService.callXy(param);
        return JSON.toJSONString(InterfaceResponse.returnSuccss(reuslt));
    }


}
